<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:p="http://primefaces.org/ui"
	template="/WEB-INF/templates/template.xhtml">
    <ui:define name="content">
    <h:form id="form" align="center">
		<div id="block" align="center" style="width : 800px; font-size: 10pt" >
		<p:panel id="panel">
        	<f:facet name="header" >
        	<h:outputText  value="Update Inventory Order" 
        	rendered="#{inventoryOrderBean.action == 'update'}" />
        	<h:outputText  value="Delete Inventory Order" 
        	rendered="#{inventoryOrderBean.action == 'delete'}" />
        	<h:outputText  value="View Inventory Order" 
        	rendered="#{inventoryOrderBean.action == 'find'}" />
        	</f:facet><br/><br/>
    		
        		<h:panelGrid columns="5" style="margin-right:10px; cellspacing : 10pt">
        			
        			<h:outputText value="Medication ID: " />
        			<p:inputText value="#{inventoryOrderBean.medicationInventory.medication.medicationId}"  rendered="#{inventoryOrderBean.action == 'update' }" />
        			<h:outputText value="#{inventoryOrderBean.medicationInventory.medication_Id}"   rendered="#{inventoryOrderBean.action == 'delete' || inventoryOrderBean.action == 'find'}" />
        			<p:spacer width="30" />
        			<h:outputText value="Medication Name: " />
        			<p:inputText value="#{inventoryOrderBean.medicationInventory.medication.genericName}" rendered="#{inventoryOrderBean.action == 'update'}" />
        			<h:outputText value="#{inventoryOrderBean.medicationInventory.medication.genericName}"  rendered="#{inventoryOrderBean.action == 'delete' || inventoryOrderBean.action == 'find'}" />
        			
        			<h:outputText value="Available Quantity:" />
        			<p:inputText value="#{inventoryOrderBean.medicationInventory.middleInitial}"  rendered="#{inventoryOrderBean.action == 'update' }" />
        			<h:outputText value="#{inventoryOrderBean.medicationInventory.middleInitial}" rendered="#{inventoryOrderBean.action == 'delete' || inventoryOrderBean.action == 'find'}" />
        			<p:spacer width="30" />
        			<h:outputText value="Reorder Quantity: " />
        			<p:inputText value="#{inventoryOrderBean.age}"  rendered="#{inventoryOrderBean.action == 'update' }" />
        			<h:outputText value="#{inventoryOrderBean.age}"   rendered="#{inventoryOrderBean.action == 'delete' || inventoryOrderBean.action == 'find'}" />
        			
        			
        			
        			<h:outputText value="Supplier Price: " />
        			<p:calendar value="#{inventoryOrderBean.medicationInventory.dob}"  maxdate="#{inventoryOrderBean.maxDate}" rendered="#{inventoryOrderBean.action == 'update' }" showOn="button"/>
        			<h:outputText value="#{inventoryOrderBean.medicationInventory.dob}" rendered="#{inventoryOrderBean.action == 'delete' || inventoryOrderBean.action == 'find'}" />
        			<p:spacer width="30" />
        			<h:outputText value="Max Quantity: " />
        			<p:inputText value="#{inventoryOrderBean.medicationInventory.physician}"  rendered="#{inventoryOrderBean.action == 'update' }" />
        			<h:outputText value="#{inventoryOrderBean.medicationInventory.physician}"   rendered="#{inventoryOrderBean.action == 'delete' || inventoryOrderBean.action == 'find'}" />
        			
        			<h:outputText value="Reserved Quantity: " />
        			<p:inputText value="#{inventoryOrderBean.medicationInventory.insurance}"  rendered="#{inventoryOrderBean.action == 'update' }" />
        			<h:outputText value="#{inventoryOrderBean.medicationInventory.insurance}"   rendered="#{inventoryOrderBean.action == 'delete' || inventoryOrderBean.action == 'find'}" />
        			<p:spacer width="30" />
        			<h:outputText value="Supplier Name: " />
        			<p:inputText value="#{inventoryOrderBean.providerName}"  rendered="#{inventoryOrderBean.action == 'update' }" />
        			<h:outputText value="#{inventoryOrderBean.providerName}"   rendered="#{inventoryOrderBean.action == 'delete' || inventoryOrderBean.action == 'find'}" />
        			
        			<h:outputText value="Supplier Email: " />
        			<p:inputText value="#{inventoryOrderBean.providerName}"  rendered="#{inventoryOrderBean.action == 'update' }" />
        			<h:outputText value="#{inventoryOrderBean.providerName}"   rendered="#{inventoryOrderBean.action == 'delete' || inventoryOrderBean.action == 'find'}" />
        			<p:spacer width="30" />
        			<h:outputText value="Supplier Number: " />
        			<p:inputText value="#{inventoryOrderBean.providerName}"  rendered="#{inventoryOrderBean.action == 'update' }" />
        			<h:outputText value="#{inventoryOrderBean.providerName}"   rendered="#{inventoryOrderBean.action == 'delete' || inventoryOrderBean.action == 'find'}" />
        			
        		</h:panelGrid>
        		<br/>
        		<br/>
        			<p:commandButton value="Reset" action="#{inventoryOrderBean.reset}" update="panel" process="@this"  rendered="#{inventoryOrderBean.action == 'update' }"  />
        			<p:commandButton value="Create" action="#{inventoryOrderBean.createPatient}"  rendered="#{inventoryOrderBean.action == 'create'}" oncomplete="alert('Medication created!!!')"/>
        			<p:commandButton value="Update" action="#{inventoryOrderBean.updatePatient}"  rendered="#{inventoryOrderBean.action == 'update'}" oncomplete="alert('Medication updated!!!')"/>
        			<p:commandButton value="Delete" action="#{inventoryOrderBean.deletePatient}"  rendered="#{inventoryOrderBean.action == 'delete'}" oncomplete="alert('Medication deleted!!!')"/>
        			<p:commandButton value="Cancel" onclick="location.href='patienthome.jsf'"/>
    		
    		</p:panel>
		</div>

		</h:form>

    </ui:define>
</ui:composition>
